<?php
/**
 * 描述：船厂频道-船厂首页。
 */
final class Exec_Shipyard_Index extends Exec
{
    public function Get()
    {
        #获取数据-是否登录
        $account=new Account(Account::Session('Username'),Account::Session('Password'));
        {
            View::Assign('IsLogin',$account->IsLogin());
        }
        $account=NULL;
        
        #获取数据-最新船厂数据
        $data=DAO_Account::Shipyard(8);
        View::Assign('Accounts',$data);

        #获取数据-订单信息
        $data=DB::GetRows('select * from shipyard_ordersheet order by ID desc limit 0,6');
        View::Assign('Shipyard_Index_Ordersheet',$data);
        
        #获取数据-船厂订单
        $data=DB::GetRows('select * from news where SubclassID='.DAO_NewsClass::SHIPYARD_ORDERSHEET_ID.' and M_IsDelete=FALSE order by ID desc limit 0,8');
        foreach($data as &$row)
        {
            $row['M_HTMLFile']=Config::PATH_RELATIVE_CONTENT_NEWS.'/'.$row['M_HTMLFile'];
        }
        View::Assign('NewsClass_ShipyardOrdersheet_ID',DAO_NewsClass::SHIPYARD_ORDERSHEET_ID);
        View::Assign('Shipyard_Index_ShipyardOrdersheet',$data);

        #获取数据-船厂动态
        $data=DB::GetRows('select * from news where SubclassID='.DAO_NewsClass::SHIPYARD_TRENDS_ID.' and M_IsDelete=FALSE order by ID desc limit 0,8');
        foreach($data as &$row)
        {
            $row['M_HTMLFile']=Config::PATH_RELATIVE_CONTENT_NEWS.'/'.$row['M_HTMLFile'];
        }
        View::Assign('NewsClass_ShipyardTrends_ID',DAO_NewsClass::SHIPYARD_TRENDS_ID);
        View::Assign('Shipyard_Index_News_ShipyardTrends',$data);


        #获取数据-船厂采购推荐
        $data=DB::GetRows('select * from procurement where M_ShipyardRecommend_Is=TRUE order by M_ShipyardRecommend_Datetime desc,ID desc');
        foreach($data as &$row)
        {
            $row['ThumbnailPath']=Config::PATH_RELATIVE_ATTACHMENT_TEMP.'/'.$row['ThumbnailPath'];
        }
        View::Assign('Shipyard_Index_ShipyardProcurementRecommend',$data);

        #渲染输出
        View::Display('shipyard/index.tpl');
    }
}
?>